<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<?php
$time = microtime();
$time = explode(" ", $time);$time = $time[1] + $time[0];$start = $time;
?>
<head>

	<!--
		Automated Pilot Utility - APU
		Flight Tracker (Beta)
		An APU Version 2.x feature preview
		APU Flight Tracker is copyright SF Games 2006, all rights reserved.
	-->

    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    <meta name="title" content="Automated Pilot Utility Flight Tracking." />
    <meta name="description" content="Automated Pilot Utility Flight Tracking maps allow you to see where your pilots are in their flight." />
    <meta name="keywords" content="APU Automated Pilot Utility Flight Tracking Google Maps API, PHP, XML" />
    <meta name="author" content="Fred Rosenbaum http://www.sf-games.com" />
    <title>APU Flight Tracking</title>

	<!-- Do it with some style -->
	<style type="text/css">
		body { margin: 10; }
		h1 { font-size: 1.2em; color: #990000; }
		a { text-decoration: none; color: #0066CC; background-color: transparent; }
      	a:hover { color: #F60; background-color: transparent; }
		div.body { font-family: Verdana, Arial, sans-serif; font-size: 0.7em; color: #333333; }
		div.copyright { font-family: Verdana, Arial, sans-serif; font-size: 0.7em; color: #666666; }
	</style>

	<!-- Have to register and get a URL specific key from Google at http://www.google.com/apis/maps/ -->
	<?php
		include "../include/config.php";
		echo '<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=' .$googleMapKey .'" type="text/javascript"></script>';
	?>

	<!-- The pages onLoad function will do the default map initialization -->
	<script type="text/javascript">
	//<![CDATA[

	function onLoad()
	{
		// Creates a map and centers it on the world.
		if ( GBrowserIsCompatible() )
		{
			// Create our "tiny" marker icon
			var icon              = new GIcon();
			icon.image            = "img/ap.png";
			icon.shadow           = "img/ap_shadow.png";
			icon.iconSize         = new GSize(15, 15);
			icon.shadowSize       = new GSize(15, 15);
			icon.iconAnchor       = new GPoint(6, 15);
			icon.infoWindowAnchor = new GPoint(5, 1);

			var map = new GMap(document.getElementById("map"));
			map.setMapType(map.getMapTypes()[2]);
	    	map.addControl(new GLargeMapControl());
	    	map.addControl(new GMapTypeControl());
			map.centerAndZoom(new GPoint(-20.7421875, 42.42345651793833), 14);

			// Creates a marker whose info window displays the given number
			// Creates a marker whose info window displays the given number
			function createMarker(point, number)
			{
				var marker = new GMarker(point, icon);

				// Show this markers index in the info window when it is clicked
				var html =  "<b>CA000" + number + "DFW</b><br>Duh Pilot Location and sh..<br>";
				html += "Direction: SWSW<br>";
				html += "Elv: -2599 ft AGL<br>";
				html += "Speed: 49 kps";
				GEvent.addListener(marker, "click", function() {marker.openInfoWindowHtml(html);});
				return marker;
			};

			// Add random markers in the map viewport using the default icon.
			var bounds = map.getBoundsLatLng();
			var width = bounds.maxX - bounds.minX;
			var height = bounds.maxY - bounds.minY;
			for (var i = 0; i < 5; i++)
			{
				var point = new GPoint(bounds.minX + width * Math.random(), bounds.minY + height * Math.random());
				var marker = createMarker(point, i + 1);
				map.addOverlay(marker);
			}

			/*
      		window.setTimeout(onTimeOut(), 60000);

			function onTimeOut()
			{
				map.recenterOrPanToLatLng(new GPoint(-122.1569, 37.4569));
				window.setTimeout(onTimeOut(), 60000);
			}
			*/
		}
	}

	//]]>
	</script>

</head>

<body onload="onLoad()">

	<div style="text-align: center">

		<!-- Main verbiage of the page -->
		<h1>APU Flight Tracker</h1>

		<!-- Display the map -->
		<div id="map" style="width: 600px; height: 500px"></div>
		<div id="message"></div>

		<div class="body">
			<p>
				Click your refresh button to update current aircraft positions.<br><br>
				Google Maps is not compatible with all web browsers.<br>
				Google Maps currently supports recent versions of Firefox/Mozilla, IE 5.5+, and Safari 1.2+, and sort of supports Opera.<br>
				IE 5.0 is not supported.<br><br>
				Current beta 1-2-2006 generates 5 random locations.<br>
				Future work will include an update to the FS APU module to send the flying pilots ID, Lat, Lon, Elv, Speed and direction to be displayed.<br>
			</p>
		</div>

		<div class="copyright">
			<?php
				include('../include/randomQuote.php');
				$time = microtime();$time = explode(" ", $time);$time = $time[1] + $time[0];
				$finish = $time;$totaltime = ($finish - $start);
				$quote = new RandomQuote;
				printf ("This page %s in %f seconds<br/><br/>", $quote->getQuote(), $totaltime);
			?>

			Flight Tracker Beta - Copyright &copy; 2006 <a href="http://www.sf-games.com">SF Games</a><br>
		</div>

	</div>

</body>
</html>
